package br.com.simulador.model;

import java.io.Serializable;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.Table;


@Entity
@Table(name="tbl_usuario")
public class Usuario extends BaseEntity implements Serializable {
	
	@Id
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	private Long id;
	
	private String matricula;
	private String nome;
	private String senha;
	private Boolean admin;

	@ManyToMany
	@JoinTable(name = "tbl_simulado_usuario", 
		joinColumns = @JoinColumn(name = "usr_id", referencedColumnName = "id"), 
		inverseJoinColumns = @JoinColumn(name = "sim_id", referencedColumnName = "id")
	)
	private Set<Simulado> simulados= new HashSet<Simulado>();	
	
	@Override
	public Long getId() {
		// TODO Auto-generated method stub
		return id;
	}

	public String getMatricula() {
		return matricula;
	}

	public void setMatricula(String matricula) {
		this.matricula = matricula;
	}

	public String getNome() {
		return nome;
	}

	public void setNome(String nome) {
		this.nome = nome;
	}

	public String getSenha() {
		return senha;
	}

	public void setSenha(String senha) {
		this.senha = senha;
	}

	public Boolean getAdmin() {
		return admin;
	}

	public void setAdmin(Boolean admin) {
		this.admin = admin;
	}

	public Set<Simulado> getSimulados() {
		return simulados;
	}

	public void setId(Long id) {
		this.id = id;
	}

}
